package com.hr.error;

/**
 * @author DSL
 * @create 2024-11-01 9:20
 */
public class CustomException extends RuntimeException{
    private int code;// 自定义错误码
    private String message;// 错误消息
    public CustomException(int code,String message) {
        super(message); // 调用父类构造函数设置消息
        this.code = code;
        this.message = message;
    }
    public CustomException(int code,String message,Throwable cause) {
        super(message,cause);  // 调用父类构造函数设置消息和原因
        this.code = code;
        this.message = message;
    }
    public int getCode() {
        return code;
    }
    @Override
    public String getMessage() {
        return message;
    }
}
